#ifndef IMAGESETTINGUI_H
#define IMAGESETTINGUI_H

#include <QWidget>
#include "BaseWidget.h"
#include "WidgetId.h"
#include "ImageSetting.h"
#include "BootSetting.h"
#include <QTimer>
#include <QButtonGroup>

namespace Ui {
class ImageSettingUi;
}

class ImageSettingUi : public BaseWidget
{
    Q_OBJECT

public:
    explicit ImageSettingUi(QWidget *parent = nullptr);
    ~ImageSettingUi()override;
    void activate()override;
    void inactivate()override;

protected:
    void changeEvent(QEvent* e)override;
protected:
    bool eventFilter(QObject *watched, QEvent *event)override;

private:
    Ui::ImageSettingUi *ui;
    uint8_t g_actionType = 0;/* bit0: 保存 bit1: 恢复出厂*/
    QTimer* g_syncTimer;
    QButtonGroup mirrorTypeBtn;
    QButtonGroup ledState;
    QButtonGroup clippedMode;
    uint8_t m_pages = 2;
    void loadSettingItemUiInfo();
    void syncValueToUi();
    void syncValueToMcu();
    void exeAction(uint8_t offset, int msec);

    void setMaskType();
public slots:
    void syncValueSlot(int id, int type);
    void syncTimerSlot();
    void updateImageSettingItemUiSlot();
    void changeMirrorTypeSlot(int index);
    void ledStateSlot(int index);

private slots:
    void on_goback_clicked();
    void on_gohome_clicked();
    void clippedModeSlot(int index);
    void on_save_clicked();
    void on_recover_clicked();
    void ImageSettingUi_Save_Slot();
    void on_left_clicked();
    void on_right_clicked();
    void on_pushButton_clicked();
    void on_pushButton_2_clicked();
    void on_pushButton_3_clicked();
    void on_pushButton_4_clicked();
};

#endif // IMAGESETTINGUI_H
